package com.breeze.stack;

public class Test {
    public static void main(String[] args) {

//        testSequenceStack();
//        testLinkStack();
        testSequenceDoubleStack();
    }

    /**
     * SequenceStack 测试
     */
    private static void testSequenceStack() {
        SequenceStack<Integer> sqStack = new SequenceStack(5);
        System.out.println(sqStack.isEmpty());
        System.out.println(sqStack.pop());
        sqStack.push(1);
        sqStack.push(2);
        sqStack.push(3);
        System.out.println(sqStack.size());
        System.out.println(sqStack.pop());
        System.out.println(sqStack.pop());
        System.out.println(sqStack.pop());
        System.out.println(sqStack.pop());
        sqStack.clear();
        System.out.println(sqStack.size());
        sqStack.push(5);
        System.out.println(sqStack.pop());
    }

    /**
     * LinkStack测试
     */
    private static void testLinkStack() {
        LinkStack<Integer> linkStack = new LinkStack<>();
        linkStack.push(1);
        linkStack.push(2);
        linkStack.push(3);
        System.out.println(linkStack.size());
        System.out.println(linkStack.isEmpty());
        System.out.println(linkStack.pop());
        System.out.println(linkStack.pop());
        System.out.println(linkStack.pop());
    }

    /**
     * SqDoubleStack 测试
     */
    private static void testSequenceDoubleStack() {
        SqDoubleStack<Integer> sqDoubleStack = new SqDoubleStack<>(3);
        sqDoubleStack.push(1, 1);
        sqDoubleStack.push(2, 1);
        sqDoubleStack.push(11, 2);
        sqDoubleStack.push(12, 2);
        sqDoubleStack.show();
        System.out.println(sqDoubleStack.pop(1));
        System.out.println(sqDoubleStack.pop(1));
        System.out.println(sqDoubleStack.pop(1));
        System.out.println(sqDoubleStack.pop(2));
        System.out.println(sqDoubleStack.pop(2));
    }
}
